<?php

namespace Modules\Admin\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Modules\Admin\Service\ManualService;


class ManualController extends BaseController
{
    /**
     *  原厂配件参数
     *  hinq 2019 11 09
     *
     **/
    public function original()
    {
        $arr_search = (array)Request::input();
        $arr_list = ManualService::get_list_original((array)$arr_search);
        echo_error($arr_list);
        return view('admin::manual.original', $arr_list['data']);
    }

    /**
     *  添加原厂配件参数视图
     *  hinq 2019 11 09
     *
     **/
    public function create()
    {
        return view('admin::manual.create');
    }

    /**
     *  编辑原厂配件参数
     *  hinq 2019 11 09
     *
     **/
    public function edit()
    {
        $nId = (int)Request::get('id');
        $arr_info = ManualService::get_one((int)$nId);
        return view('admin::manual.edit', ['info' => $arr_info]);
    }

    /**
     *  编辑原厂配件参数
     *  hinq 2019 11 09
     *
     **/
    public function update()
    {
        $arr_input = (array)Request::all();
        return ManualService::edit_one((array)$arr_input);
    }

    /**
     *  删除原厂配件参数
     *  hinq 2019 11 09
     *
     **/
    public function delete()
    {
        $nId = (int)Request::get('id');
        return ManualService::delete_one((int)$nId);
    }

    /**
     *  保养项目列表
     *  hinq 2019 11 15
     *
     **/
    public function upkeep()
    {
        $arr_search = (array)Request::all();
        $arr_list = ManualService::get_list_upkeep((array)$arr_search);
        return view('admin::manual.upkeep', $arr_list['data']);
    }

    /**
     *  添加保养项目视图
     *  hinq 2019 11 15
     *
     **/
    public function create_upkeep()
    {
        return view('admin::manual.create_upkeep');
    }

    /**
     *  添加保养项目数据
     *  hinq 2019 11 15
     *
     **/
    public function store_upkeep()
    {
        $arr_input = (array)Request::all();
        return ManualService::store_upkeep((array)$arr_input);
    }

    /**
     *  编辑保养项目视图
     *  hinq 2019 11 15
     *
     **/
    public function edit_upkeep()
    {
        $nId = (int)Request::get('id');
        $arr_list = ManualService::get_one_upkeep((int)$nId);
        return view('admin::manual.edit_upkeep', ['info' => $arr_list['data']]);
    }

    /**
     *  编辑保养项目数据
     *  hinq 2019 11 15
     *
     **/
    public function update_upkeep()
    {
        $arr_input = (array)Request::all();
        return ManualService::update_upkeep((array)$arr_input);
    }

    /**
     *  删除指定的保养项目类型数据
     *  hinq 2019 11 16
     *
     **/
    public function delete_upkeep()
    {
        $nId = (int)Request::get('id');
        return ManualService::delete_upkeep((int)$nId);
    }

}